package com.mashibing.vector;

public class Erase {

    //快慢指针删除元素O(n)
    public int[] erase(int[] arr,int tar){
        int slow =0;
        for (int fast=0;fast<arr.length;fast++){
            if(arr[fast]!=tar) {
                arr[slow++]=arr[fast];
            }
        }
        return arr;
    }
}
